<!DOCTYPE html>
<html lang="en">
<!--表示文档用的语言 -->

<head>
    <meta charset="UTF-8">
    <meta http-equiv="Content-Type" content="text/html">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta name="viewport" content="initial-scale=1.0, width=device-width, maximum-scale=1, minimum-scale=1, user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="IE=edge"><!-- 告诉IE浏览器用最新的引擎去渲染这个页面 -->
    <title>商家-会员中心</title>
    <link href="https://cdn.bootcss.com/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
    <link href="https://at.alicdn.com/t/font_1440001_47llmi4hsil.css" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="css/globle.css" />
    <link rel="stylesheet" href="css/style.css">
    <link rel="stylesheet" href="css/user.css">
    <link rel="stylesheet" href="css/media.css">
</head>

<body>
    <div id="header"></div>
    <!-- 主体 -->
    <section class="info">
        <div class="container">
            <div class="info-all">
                <div class="row">
                    <div class="col-md-10 col-xs-12 tab-content">
                        <!-- 店铺信息 -->
                        <div class="tab-pane active" id="info01">
                            <div class="user-content">
                                <div class="support-content-wrap">
                                    <div class="bus-info">
                                        <div class="name">
                                            <div class="left">
                                                <span>名称：</span>
                                                <span class="name-id">店铺名称</span>
                                            </div>
                                        </div>
                                        <div class="logo">
                                            <div class="left">
                                                <span>LOGO：</span>
                                                <span class="logo-id"><img src="img/logos.png" alt=""></span>
                                            </div>
                                        </div>
                                        <div class="album">
                                            <div class="left">
                                                <span>相册：</span>
                                                <div class="album-id clearfix">
                                                    <span class="img-group">
                                                        <img src="img/logos.png" alt="" data-toggle="modal" data-target="#album">
                                                        <span class="center-block text-center">标题</span>
                                                    </span>
                                                    <span class="img-group">
                                                        <img src="img/logos.png" alt="" data-toggle="modal" data-target="#album">
                                                        <span class="center-block text-center">标题</span>
                                                    </span>
                                                    <span class="img-group">
                                                        <img src="img/logos.png" alt="" data-toggle="modal" data-target="#album">
                                                        <span class="center-block text-center">标题</span>
                                                    </span>
                                                    <span class="img-group">
                                                        <img src="img/logos.png" alt="" data-toggle="modal" data-target="#album">
                                                        <span class="center-block text-center">标题</span>
                                                    </span>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="user-content-bot">
                                        <img src="https://myaccount.aoscdn.com/cdn/img/index/promotion.jpg?401d" alt="" class="img-responsive">
                                    </div>
                                </div>
                            </div>
                        </div>
                        <!-- 交易评论 -->
                        <div class="tab-pane" id="info04">
                            <div class="user-content">
                                <div class="support-content-wrap">
                                    <h4>交易评论</h4>
                                    <ul>
                                        <li>
                                            <a href="#">
                                                <h5 class="tit">评论人：小鱼同学 <em>2019-05-11 10:11:55</em></h5>
                                                <p class="line">什么资源，直接在视频搜索框里搜索就完事了，输入关键字都是有的，直接按着顺序刷视频也是可以的</p>
                                                <div class="fromecount">
                                                    <p>xxx平台</p>
                                                </div>
                                            </a>
                                        </li>
                                        <li>
                                            <a href="#">
                                                <h5 class="tit">评论人：小鱼同学 <em>2019-05-11 10:11:55</em></h5>
                                                <p class="line">什么资源，直接在视频搜索框里搜索就完事了，输入关键字都是有的，直接按着顺序刷视频也是可以的</p>
                                                <div class="fromecount">
                                                    <p>xxx平台</p>
                                                </div>
                                            </a>
                                        </li>
                                        <li>
                                            <a href="#">
                                                <h5 class="tit">评论人：小鱼同学 <em>2019-05-11 10:11:55</em></h5>
                                                <p class="line">什么资源，直接在视频搜索框里搜索就完事了，输入关键字都是有的，直接按着顺序刷视频也是可以的</p>
                                                <div class="fromecount">
                                                    <p>xxx平台</p>
                                                </div>
                                            </a>
                                        </li>
                                    </ul>
                                </div>
                            </div>
                        </div>
                        <!-- 店铺公告 -->
                        <div class="tab-pane" id="info03">
                            <div class="user-content">
                                <div class="support-content-wrap">
                                    <h4>店铺公告</h4>
                                    <ul>
                                        <li>
                                            <a href="#">
                                                <h5 class="tit">人生如同长途的旅行，细细品味，乐在其中！</h5>
                                                <div class="time"><span>2019-5-18</span>&nbsp;<span>08:23:00</span></div>
                                            </a>
                                        </li>
                                        <li>
                                            <a href="#">
                                                <h5 class="tit">人生如同长途的旅行，细细品味，乐在其中！</h5>
                                                <div class="time"><span>2019-5-18</span>&nbsp;<span>08:23:00</span></div>
                                            </a>
                                        </li>
                                        <li>
                                            <a href="#">
                                                <h5 class="tit">人生如同长途的旅行，细细品味，乐在其中！</h5>
                                                <div class="time"><span>2019-5-18</span>&nbsp;<span>08:23:00</span></div>
                                            </a>
                                        </li>
                                        <li>
                                            <a href="#">
                                                <h5 class="tit">人生如同长途的旅行，细细品味，乐在其中！</h5>
                                                <div class="time"><span>2019-5-18</span>&nbsp;<span>08:23:00</span></div>
                                            </a>
                                        </li>
                                        <li>
                                            <a href="#">
                                                <h5 class="tit">人生如同长途的旅行，细细品味，乐在其中！</h5>
                                                <div class="time"><span>2019-5-18</span>&nbsp;<span>08:23:00</span></div>
                                            </a>
                                        </li>
                                        <li>
                                            <a href="#">
                                                <h5 class="tit">人生如同长途的旅行，细细品味，乐在其中！</h5>
                                                <div class="time"><span>2019-5-18</span>&nbsp;<span>08:23:00</span></div>
                                            </a>
                                        </li>
                                    </ul>
                                </div>
                            </div>
                        </div>
                        <!-- 店铺评论 -->
                        <div class="tab-pane" id="info06">
                            <div class="user-content">
                                <div class="support-content-wrap">
                                    <ul class="comment">
                                        <li>
                                            <a href="#">
                                                <h5 class="tit">店铺评论<em>2019-05-11 10:11:55</em></h5>
                                                <p class="line">如果一个人影响到了你的情绪，你的焦点应该放在控制自己的情绪上，而不是影响你情绪的人身上。只有这样，才能真正自信起来</p>
                                                <div class="fromecount">
                                                    <p><em>发帖人：小鱼同学</em></p>
                                                    <p>那些不经意想起的，总是记忆里最深刻的</p>
                                                </div>
                                            </a>
                                        </li>
                                        <li>
                                            <a href="#">
                                                <h5 class="tit">店铺评论<em>2019-05-11 10:11:55</em></h5>
                                                <p class="line">如果一个人影响到了你的情绪，你的焦点应该放在控制自己的情绪上，而不是影响你情绪的人身上。只有这样，才能真正自信起来</p>
                                                <div class="fromecount">
                                                    <p><em>发帖人：小鱼同学</em></p>
                                                    <p>那些不经意想起的，总是记忆里最深刻的</p>
                                                </div>
                                            </a>
                                        </li>
                                        <li>
                                            <a href="#">
                                                <h5 class="tit">店铺评论<em>2019-05-11 10:11:55</em></h5>
                                                <p class="line">如果一个人影响到了你的情绪，你的焦点应该放在控制自己的情绪上，而不是影响你情绪的人身上。只有这样，才能真正自信起来</p>
                                                <div class="fromecount">
                                                    <p><em>发帖人：小鱼同学</em></p>
                                                    <p>那些不经意想起的，总是记忆里最深刻的</p>
                                                </div>
                                            </a>
                                        </li>
                                    </ul>
                                </div>
                            </div>
                        </div>
                        <!-- 撰稿人 -->
                        <div class="tab-pane" id="writing">
                            <div class="user-content">
                                <div class="support-content-wrap">
                                    <div class="writing-content">
                                        <h5 class="tit">撰稿人</h5>
                                        <div class="input-group">
                                            <input type="email" class="form-control" id="userId" placeholder="请输入会员邮箱账号">
                                            <span class="input-group-btn">
                                                <button class="btn btn-default" type="button" id="add-user">添加</button>
                                            </span>
                                        </div>
                                        <ul id="plat-list">
                                            <li>zitai <span class="btn pull-right">删除</span></li>
                                        </ul>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <!-- 店铺设置 -->
                        <div class="tab-pane" id="userSetting">
                            <div class="user-content">
                                <div class="support-content-wrap">
                                    <ul id="settingInfo">
                                        <!-- <li><span>店铺名称：</span><input type="text"></li> -->
                                        <li><span>店铺logo：</span>
                                            <div style="">
                                                <ul class="upload-ul clearfix">
                                                    <li class="upload-pick">
                                                        <div class="webuploader-container clearfix" id="goodsUpload"></div>
                                                    </li>
                                                    <span class="btn btn-primary" id="btn">上传头像</span>
                                                </ul>
                                            </div>
                                        </li>
                                        <li><span>店铺相册：</span>
                                            <div style="">
                                                <ul class="upload-ul clearfix">
                                                    <li class="upload-pick">
                                                        <div class="webuploader-container clearfix" id="goodsUpload1"></div>
                                                    </li>
                                                    <span class="btn btn-primary" id="btn1">上传相册</span>
                                                </ul>
                                            </div>
                                        </li>
                                        <li><span class="btn btn-primary" id="setBtn">保存</span></li>
                                    </ul>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-2 col-xs-12">
                        <div class="info-menu">
                            <ul class="nav nav-tabs">
                                <li class="active">
                                    <a href="#info01" aria-controls="info01" role="tab" data-toggle="tab">
                                        <i class="iconfont icon-Userpersonalinform"></i>
                                        店铺信息
                                        <i class="glyphicon glyphicon-menu-right hidden-lg hidden-md hidden-sm"></i>
                                    </a>
                                </li>
                                <li>
                                    <a href="#info04" aria-controls="info04" role="tab" data-toggle="tab">
                                        <i class="iconfont icon-gerenxinxi"></i>
                                        交易评论
                                        <i class="glyphicon glyphicon-menu-right hidden-lg hidden-md hidden-sm"></i>
                                    </a>
                                </li>
                                <li>
                                    <a href="#info03" aria-controls="info03" role="tab" data-toggle="tab">
                                        <i class="iconfont icon-dd"></i>
                                        店铺公告
                                        <i class="glyphicon glyphicon-menu-right hidden-lg hidden-md hidden-sm"></i>
                                    </a>
                                </li>
                                <li>
                                    <a href="#info06" aria-controls="info06" role="tab" data-toggle="tab">
                                        <i class="iconfont icon-fapiao"></i>
                                        店铺评论
                                        <i class="glyphicon glyphicon-menu-right hidden-lg hidden-md hidden-sm"></i>
                                    </a>
                                </li>
                                <li>
                                    <a href="#writing" aria-controls="writing" role="tab" data-toggle="tab">
                                        <i class="iconfont icon-xiugaimima"></i>
                                        撰稿人
                                        <i class="glyphicon glyphicon-menu-right hidden-lg hidden-md hidden-sm"></i>
                                    </a>
                                </li>
                                <li>
                                    <a href="#userSetting" role="tab" data-toggle="tab">
                                        <i class="glyphicon glyphicon-cog"></i>
                                        店铺设置
                                        <i class="glyphicon glyphicon-menu-right hidden-lg hidden-md hidden-sm"></i>
                                    </a>
                                </li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>
    <div id="footer"></div>
</body>
<script src="https://cdn.bootcss.com/jquery/3.1.1/jquery.min.js"> </script>
<script src="https://cdn.bootcss.com/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="js/webuploader.min.js"></script>
<script src="js/diyUpload.js"></script>
<script src="js/mine.js"></script>
<script src="js/core.js"></script>
<script>
$(function() {
    $("#header").load("./header.html")
    $("#footer").load("./footer.html")
    let merchantId = JSON.parse(localStorage.user).id;
    var myreg = /^([\.a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/; //  邮箱正则484525121@qq.com
    let userInfo = JSON.parse(localStorage.user);
    $("#info01 .name-id").html(userInfo.name)
    $("#info01 .logo-id").html(`<img src="${userInfo.imgPath}" alt="">`)
    // 处理相册路径
    let albumArr = userInfo.albumPaths
    albumArr = albumArr.substring(0,albumArr.length-1).split("=");
    console.log(albumArr)
    let albumItem = "";
    $.each(albumArr,function(index,val){
        albumItem += `<span class="img-group"><img src="${val}" alt="" data-toggle="modal" data-target="#album">
                      <span class="center-block text-center">标题</span></span>`;
    })
    $(".album .album-id").html(albumItem);
    // 该平台下的撰稿人列表
    let item1 = '';
    Getdata(getAgentByMerchant, { merchantId }).then(res => {
        console.log(res)
        $.each(res.data, function(index, val) {
            item1 += `<li>${val.name} <span class="btn pull-right" data-id="${index}">删除</span></li>`;
        })
        $("#plat-list").html(item1);
    })
    $("#add-user").click(function() {
        let email = $("#userId").val();
        if (email == '') {
            alert("邮箱不能为空！")
        } else if (!myreg.test(email)) {
            alert("请输入有效的邮箱地址！");
        } else {
            Getdata(vipList, {
                size: 1,
                current: 1,
                email
            }).then(res => {
                console.log(res)
                if (res.data.records.length < 1) {
                    alert("打扰了，查无此人！")
                    return false;
                }
                let userId = res.data.records[0].id;
                Getdata(setUser, {
                    merchantId,
                    userId
                }).then(res => {
                    alert("设置成功！")
                })
            })
        }
    })

    //店铺设置 userSetting  修改平台商信息 setBtn
    //上传图片
    let userimg = "";
    var $tgaUpload = $('#goodsUpload').diyUpload({
        url: apiurl + 'exchange/attachment/fileUpload',
        success: function(res) {
            console.log(res)
            userimg = res.data;
            console.log(userimg)
        },
        error: function(err) {},
        buttonText: '',
        accept: {
            title: "Images",
            extensions: 'gif,jpg,jpeg,bmp,png'
        },
        thumb: {
            width: 120,
            height: 90,
            quality: 100,
            allowMagnify: true,
            crop: true,
            type: "image/jpeg"
        }
    });
    $("#btn").click(function() { $tgaUpload.upload() });

    // 上传相册
    let albumPaths = '';
    var $tgaUpload1 = $('#goodsUpload1').diyUpload({
        url: apiurl + 'exchange/attachment/fileUpload',
        success: function(res) {
            console.log(res)
            albumPaths += res.data + '=';
            console.log(albumPaths)
        },
        error: function(err) {},
        buttonText: '',
        accept: {
            title: "Images",
            extensions: 'gif,jpg,jpeg,bmp,png'
        },
        thumb: {
            width: 120,
            height: 90,
            quality: 100,
            allowMagnify: true,
            crop: true,
            type: "image/jpeg"
        }
    });
    $("#btn1").click(function() { $tgaUpload1.upload() });
    // 保存并提交修改
    $("#setBtn").click(function() {
        console.log(albumPaths)
        console.log(userimg)
        $.ajax({
            url: apiurl + updateOneById,
            type: 'POST',
            dataTyp: "json",
            contentType: "application/json;charset=utf-8",
            data: JSON.stringify({
                "id": userInfo.id,
                "imgPath": userimg,
                "albumPaths": albumPaths,
                 "status": 1
            }),
            success: res => {
                if(res.success == true){
                    alert("修改成功，请重新登录！")
                    quite();
                    window.location.href = "login.html";
                }
                
                console.log(res)
            },
        })

    })






    // 查询店铺评论 -我的评论 1查询我的评论 2查询我的回复
    Getdata(getMyCommentList, { getMyCommentList: userInfo.id, type: 1 }).then(res => {
        console.log(res);
    })



})
</script>

</html>